//
//  DetailFooter.m
//  敢唆嘛!
//
//  Created by 教主 on 15/11/25.
//  Copyright © 2015年 zms. All rights reserved.
//

#import "DetailFooter.h"
#import "Device.h"
#import "Define.h"

@interface DetailFooter ()
//=====表尾各控件=====
@property(nonatomic , strong)UIImageView *footerImageView;//表尾头像
@property(nonatomic , strong)UILabel *nameLabel;//用户名称
@property(nonatomic , strong)UILabel *attentionLabel;//关注数
@property(nonatomic , strong)UILabel *readerLabel;//读者数
@property(nonatomic , strong)UIButton *attentionBtn;//关注按钮
@property(nonatomic , strong)UIButton *readerBtn;//读者按钮
@end

@implementation DetailFooter

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if (self)
    {
        //    表尾视图
        UIView *footerView = [[UIView alloc]init];
        //    footerView.backgroundColor = [UIColor grayColor];
        //    footerView.alpha = 0.1;
        UIView *grayView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KSWidth, KSHeight)];
        grayView.backgroundColor = [UIColor grayColor];
        grayView.alpha = 0.1;
        [footerView addSubview:grayView];
        
        //    表尾头像
        self.footerImageView = [[UIImageView alloc]initWithFrame:CGRectMake(KSWidth/5*2, KSHeight/3, KSWidth/5, KSWidth/5)];
        self.footerImageView.layer.cornerRadius = KSWidth/10;
        self.footerImageView.layer.masksToBounds = YES;
        [footerView addSubview:self.footerImageView];
        
//        //    信封
//        UIImageView *letterImageView = [[UIImageView alloc]initWithFrame:CGRectMake(KSWidth/5, KSWidth/3*2, KSWidth/12, KSWidth/12)];
//        letterImageView.image = [UIImage imageNamed:@"xinfeng"];
//        letterImageView.layer.cornerRadius = KSWidth/24;
//        letterImageView.layer.masksToBounds = YES;
//        [footerView addSubview:letterImageView];
//        
//        //    加好友
//        UIImageView *friendImageView = [[UIImageView alloc]initWithFrame:CGRectMake(KSWidth/5*3.6, KSWidth/3*2, KSWidth/12, KSWidth/12)];
//        friendImageView.image = [UIImage imageNamed:@"haoyou"];
//        friendImageView.layer.cornerRadius = KSWidth/24;
//        friendImageView.layer.masksToBounds = YES;
//        [footerView addSubview:friendImageView];
        
        //    用户名
        self.nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, KSWidth/5*4+space, KSWidth, space)];
        self.nameLabel.textAlignment = NSTextAlignmentCenter;
        self.nameLabel.font = [UIFont systemFontOfSize:12];
        [footerView addSubview:self.nameLabel];
        
        UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, KSWidth/5*4+space*3, KSWidth, space)];
        label.textAlignment = NSTextAlignmentCenter;
        label.text = @"在故事里相遇";
        label.font = [UIFont systemFontOfSize:12];
        [footerView addSubview:label];
        
        [self.contentView addSubview:footerView];
        
//        //    关注Btn
//        self.attentionBtn = [UIButton buttonWithType:UIButtonTypeSystem];
//        self.attentionBtn.frame = CGRectMake(0, KSWidth, KSWidth/2, space);
//        UILabel *attLabel = [[UILabel alloc]initWithFrame:CGRectMake(KSWidth/3.5, 0, space*2, space)];
//        attLabel.text = @"关注";
//        attLabel.font = [UIFont systemFontOfSize:12];
        
//        //    关注数
//        self.attentionLabel = [[UILabel alloc]initWithFrame:CGRectMake(KSWidth/3+space, 0, space*2, space)];
//        self.attentionLabel.text = @"52";
//        //    self.attentionLabel.textAlignment = NSTextAlignmentCenter;
//        self.attentionLabel.font = [UIFont systemFontOfSize:12];
//        [self.attentionBtn addSubview:self.attentionLabel];
//        [self.attentionBtn addSubview:attLabel];
        
//        [footerView addSubview:self.attentionBtn];
//        
//        //    读者Btn
//        self.readerBtn = [UIButton buttonWithType:UIButtonTypeSystem];
//        self.readerBtn.frame = CGRectMake(KSWidth/2, KSWidth, KSWidth/2, space);
//        UILabel *readLabel = [[UILabel alloc]initWithFrame:CGRectMake(space*2, 0, space*2, space)];
//        readLabel.text = @"读者";
//        readLabel.font = [UIFont systemFontOfSize:12];
//        
//        //    读者数
//        self.readerLabel = [[UILabel alloc]initWithFrame:CGRectMake(space*4, 0, space*2, space)];
//        self.readerLabel.font = [UIFont systemFontOfSize:12];
//        self.readerLabel.text = @"35";
//        [self.readerBtn addSubview:self.readerLabel];
//        [self.readerBtn addSubview:readLabel];
//        
//        [footerView addSubview:self.readerBtn];
    }
    return self;
}


// 传值
- (void)setHomeModel:(HomeModel *)model
{
    // 表尾头像
    [self.footerImageView sd_setImageWithURL:[NSURL URLWithString:model.userHeader]];
    self.nameLabel.text = model.userName;
}

- (void)setRealityModel:(RealityModel *)model
{
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
